package com.ep.modules.app.service.impl;

import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.ep.common.utils.PageUtils;
import com.ep.modules.app.dao.AppResourceSchedulingMapper;
import com.ep.modules.app.entity.AppResourceScheduling;
import com.ep.modules.app.entity.AppResourceSchedulingExample;
import com.ep.modules.app.service.AppResourceSchedulingService;
import java.util.List;
import java.util.Map;
import org.apache.commons.lang.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

@Service
public class AppResourceSchedulingServiceImpl implements AppResourceSchedulingService {
    @Autowired
    private AppResourceSchedulingMapper appResourceSchedulingMapper;

    public PageUtils queryPage(Map<String, Object> params) {
        String searchKey = (String)params.get("searchKey");
        Long searchUserId = (Long)params.get("searchUserId");
        AppResourceSchedulingExample example = new AppResourceSchedulingExample();
        AppResourceSchedulingExample.Criteria criteria = example.createCriteria();
        List<AppResourceScheduling> list = appResourceSchedulingMapper.selectByExample(example);
        Page<AppResourceScheduling> page = new Page<>();
        page.setRecords(list);
        return new PageUtils(page);
    }

    public AppResourceScheduling getById(Long id) {
        return appResourceSchedulingMapper.selectByPrimaryKey(id.intValue());
    }

    public void save(AppResourceScheduling entity) {
        appResourceSchedulingMapper.insert(entity);
    }

    public void update(AppResourceScheduling entity) {
        appResourceSchedulingMapper.updateByPrimaryKeySelective(entity);
    }

    public void deleteBatch(Long[] ids) {
        for (Long id : ids) {
                appResourceSchedulingMapper.deleteByPrimaryKey(id.intValue());
        }
    }
}